package yijy.grapticket;

/**
 * Created by yijy on 2017/7/31.
 */
public class GrapThread extends Thread {

    private static int tic=1000;

    private static int point=0;


    @Override
    public void run() {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        if(tic>0){
            point++;
            tic--;
            System.out.println(getName()+"抢到第"+point+"票了,剩余"+tic+"张票。");
        }else{
            System.out.println(getName()+"抢票失败，票已售罄。");
        }
    }
}
